<template>
  <div class="cont">
    <p>
      <YanGanGoodsEditComponent v-if="this.active" :goods-details="this.goodsDetails"/>
    </p>
  </div>
</template>
<script>


import YanGanGoodsEditComponent from '../../components/goods/yanGanGoodsEditComponent.vue'
import {queryGoodsDetail} from "../../services/goods";

export default {
  name:"YanGanGoodsEdit",
  components: {
    YanGanGoodsEditComponent
  },
  data () {
    return {
      active:false,
      goodsDetails:Object,
    }
  },
  created() {
    this.getGoodsDetails(this.$route.query.id)
  },
  methods: {
    // 获取商品详情
    async getGoodsDetails(goodsId) {
      const data = {
        id:goodsId
      }
      console.log('request goods detail param is ',data)
      const res = await queryGoodsDetail(data);
      console.log('queryGoodsDetail data is ',res)
      if (res.code === 0) {
        this.goodsDetails=res.data;
        this.goodsDetails.goodsId=res.data.id
        this.active=true
      }
    },

    change (va) {
      console.log(va)
    },
    handleClick (tab, event) {
      console.log(tab, event)
    }
  }
}
</script>
 